package com.trade.wzj.service.yang.impl;

import java.util.List;

import com.trade.wzj.dao.yang.ClientInfoQuotaDaoYang;
import com.trade.wzj.model.xiang.ClientQuota;
import com.trade.wzj.model.xiang.ClientQuotaDetails;
import com.trade.wzj.service.yang.ClientInfoQuotaServiceYang;

public class ClientInfoQuotaImplYang implements ClientInfoQuotaServiceYang {
	
	private ClientInfoQuotaDaoYang clientInfoQuotaDaoYang;

	public ClientInfoQuotaDaoYang getClientInfoQuotaDaoYang() {
		return clientInfoQuotaDaoYang;
	}

	public void setClientInfoQuotaDaoYang(ClientInfoQuotaDaoYang clientInfoQuotaDaoYang) {
		this.clientInfoQuotaDaoYang = clientInfoQuotaDaoYang;
	}

	@Override
	public List<ClientQuota> findClientQuota(String clientName) throws Exception {
		List<ClientQuota> list = null;
		try {
			list = clientInfoQuotaDaoYang.findClientQuota(clientName);
		} catch (Exception e) {
			e.printStackTrace();
			throw new Exception();
		}
		return list;
	}

	@Override
	public List<ClientQuota> findClientQuotaById(Integer id) throws Exception {
		List<ClientQuota> list = null;
		if(null==id) {
			throw new Exception("请选择一个报价单号！");
		} else {
			try {
				list = clientInfoQuotaDaoYang.findClientQuotaById(id);
			} catch (Exception e) {
				e.printStackTrace();
				throw new Exception("没有找到您想要的数据！！");
			}
		}
		return list;
	}

	//根据客户报价编号查询客户 报价详情
	@Override
	public List<ClientQuotaDetails> getClientDetailPrice(Integer id,String productName) throws Exception {
		List<ClientQuotaDetails> list=null;
		try {
			list=clientInfoQuotaDaoYang.getClientDetailPrice(id,productName);
		} catch (Exception e) {
			throw new Exception();
		}
		return list;
	}

	@Override
	public List<ClientQuotaDetails> getProducts(Integer clientInfoId,Integer[] list) throws Exception {
		List<ClientQuotaDetails> ls=null;
		try {
			ls=clientInfoQuotaDaoYang.getProducts(clientInfoId,list);
		} catch (Exception e) {
			throw new Exception();
		}
		
		return ls;
	}

	//查询所有客户报价信息，亦可通过客户名称查询报价
	@Override
	public List<ClientQuota> getAllClientPriceList(String clientName) throws Exception {
		List<ClientQuota> list=null;
		try {
			list=clientInfoQuotaDaoYang.getAllClientPriceList(clientName);
		} catch (Exception e) {
			throw new Exception();
		}
		return list;
	}

}
